/**
 * 
 */
package com.yidu.drug.action;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yidu.drug.common.Message;
import com.yidu.drug.model.PoBreakdown;
import com.yidu.drug.service.PoBreakdownService;

/**
 * 总店采购订单明细表Action
 * @author 王志伟
 * @date 2018年8月9日 下午8:05:14
 * @version 1.0
 */
@Controller
@RequestMapping("poBreakdown")
public class PoBreakdownAction {
	//采购明细的Service
	@Resource
	private PoBreakdownService pobService;
	
	//消息类
	Message m=new Message();
	
	@RequestMapping("/findAll")
	@ResponseBody
	public Map<String, Object> findAll(String limit, String page,String pobName,String poId){
		System.out.println("进入采购明细查询所有的方法"+pobName);
		return pobService.findAll(limit,page,pobName,poId);
	}
	
	@RequestMapping("/findMatIdByPoId")
	@ResponseBody
	public List<PoBreakdown> findMatIdByPoId(String poId){
		System.out.println("进入根据采购单ID查询明细的方法+ poId="+poId);
		return pobService.findMatIdByPoId(poId);
	}
	
	@RequestMapping("/addOrDelete")
	@ResponseBody
	public Message addOrDelete(String matIds,String poId){
		System.out.println("进入明细添加addOrDelete方法 材料ID为+"+matIds+"采购ID是+"+poId);
		int count =pobService.addOrDelete(matIds,poId);
		m.setNum(count);
		return m;
	}
	
	@RequestMapping("/updateOrAdd")
	@ResponseBody
	public Message updateOrAdd(String a,String conId,String poRemark,String poSumnum,String poSumprice){
		int count=pobService.updateOrAdd(a, conId, poRemark, poSumnum, poSumprice);
		m.setNum(count);
		return m;
	}
}
